package com.boge.study.collection;

/**
 * 金额转换，阿拉伯数字的金额转换成中国传统的形式如：（￥1011）－>（一千零一拾一元整）输出
 * @author Administrator
 *
 */
public class AmountConversion {
	
	private static final char[] data = {'零', '壹', '贰', '叁','肆','伍','陆','柒','捌','玖'};
	
	private static final char[] units = {'元','拾','佰','仟','万','拾','佰','仟','亿'};
	
	public static void main(String[] args) {
		amountConversion(123);
//		System.out.println(212%10);
	}
	
	public static String amountConversion(int money) {
		
		StringBuffer sb = new StringBuffer();
		int unit = 0;
		while (money != 0) { 
			sb.insert(0, units[unit++]);
			int number = money%10;
			sb.insert(0, data[number]);
			money /= 10;
		}
		System.out.println(sb.toString());
		return sb.toString();
		
	}
	
}
